package com.turing.data.scripts.contract.transfer

import com.turing.data.vo.out.review.DependParamsVO
import com.turing.data.vo.out.review.TaskElementVO


/**
 * 场景：资产管理合同-v3.0
 * 版本：Version 3.0
 * 要素名称：运作方式2
 */

class OperateMethod2_30183_10_transfer {

    static List< TaskElementVO.DrawResultVO > doConvert(List< TaskElementVO.DrawResultVO > resultVOs, DependParamsVO dependParams){

        for( drawResultVO in resultVOs ) {

            if( drawResultVO.childTaskSn == null || drawResultVO.childTaskSn == ""){

                continue

            }
            String modelValue = drawResultVO.text

            String REGEX_CLOSED_1 = /.*不开放.*/
            String REGEX_CLOSED_2 = /.*封闭运作.*/
            String REGEX_CLOSED_3 = /.*封闭式.*/

//            String REGEX_OPEN_MONTHLY_1 = /.*按月*/
//            String REGEX_OPEN_MONTHLY_2 = /.*每月*/
//            String REGEX_OPEN_WEEKLY = /.*按周.*/
//            String REGEX_OPEN_WEEKLY_2 = /.*每周*/
//            String REGEX_OPEN_DAY = /.*按日.*/
//            String REGEX_OPEN_DAY_2 = /.*每日.*/
//            String REGEX_OPEN_MONTHLY_3 = /.*按季度.*/
//            String REGEX_OPEN_MONTHLY_4 = /.*每季度.*/


            String REGEX_OPEN_DAY = /.*按日定期开放.*/
            String REGEX_OPEN_WEEKLY = /.*按周定期开放.*/
            String REGEX_OPEN_MONTHLY_1 = /.*按月定期开放*/
            String REGEX_OPEN_MONTHLY_3 = /.*按季度定期开放.*/
//            String REGEX_OPEN_1 = /.*开放多次.*/
//            String REGEX_OPEN_2 = /.*始终开放.*/
//            String REGEX_OPEN_3 = /.*成立.*个月.*/
//            String REGEX_ONE_MOST_1= /.*满.*年开放一次.*/
//            String REGEX_ONE_MOST_2= /.*满.*\d月开放一次.*/
//            String REGEX_OPEN_PER_3MONTH = /.*不定期开放运作.*/
//            String REGEX_OPEN_NOT_PERIOD = /.*不定期开放.*/

            String str = modelValue.replaceAll("\n", "").replaceAll("\r", "")
            if( str =~ REGEX_CLOSED_1 ||str =~ REGEX_CLOSED_2 ||str =~ REGEX_CLOSED_3){
                drawResultVO.businessValue = "封闭运作"
                drawResultVO.type = 1
            }
//            else if (  modelValue =~ REGEX_OPEN_MONTHLY_1 || modelValue =~ REGEX_OPEN_MONTHLY_2||
//                        modelValue =~ REGEX_OPEN_WEEKLY || modelValue =~ REGEX_OPEN_WEEKLY_2 ||
//                        modelValue =~ REGEX_OPEN_DAY || modelValue =~ REGEX_OPEN_DAY_2 ||
//                        modelValue =~ REGEX_OPEN_MONTHLY_3 || modelValue =~ REGEX_OPEN_MONTHLY_4
//            )
            else if (  modelValue =~ REGEX_OPEN_MONTHLY_1 ||
                        modelValue =~ REGEX_OPEN_WEEKLY||
                        modelValue =~ REGEX_OPEN_DAY ||
                        modelValue =~ REGEX_OPEN_MONTHLY_3
                )
                {
                drawResultVO.businessValue = "定期开放"
                drawResultVO.type = 1

            }else{
                drawResultVO.businessValue = "其他" +"（"+ modelValue.substring(modelValue.indexOf("本计划"))+ "）"
                drawResultVO.type = 1
            }
        }

        return resultVOs
    }

}
